package cn.itsource.org.domain;

import cn.itsource.basic.domain.BaseTreeNode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

/**
 * 格式化:ctrl+alt+L
 */
@Table(name="t_department") //表名
@Data //生成get set hashcode equals
@AllArgsConstructor //有参构造
@NoArgsConstructor //无参构造
@ApiModel(value = "dafeifeng", description = "")
public class Department extends BaseTreeNode<Department> {


    //编号
    @ApiModelProperty(value = "编号")
    @Size(min = 3,max = 10,message = "部门编号必须在3-10位之间")
    private String sn;

    //部门名称
    @ApiModelProperty(value = "部门名称")
    @NotBlank(message = "部门名称不能为空")
    private String name;

    //状态 0:正常 1:禁用
    private Integer state;

    //部门经理id
    @Column(name="manager_id")
    private Long managerId;

    //上级部门
    @Column(name="parent_id")
    private Long parentId;

    //部门目录路径
    @Column(name="dir_path")
    private String dirPath;

    @Transient
    private Employee manager;

    @Transient
    private Department parent;

    @Transient
    private Long[] parentIds;
}
